package com.sun.dao;

import com.fasterxml.jackson.databind.JsonDeserializer;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

@Data
@NoArgsConstructor
@AllArgsConstructor
public class Person {
    private Integer id;
    private String name;
    private Integer age;

    /**
     * 1 男,0 女
     */
    private Integer gender;

    @JsonDeserialize(using = GenderJsonDeserializer.class)
    public void setGender(Integer gender){
        this.gender = gender;
    }

    @JsonSerialize(using = GenderJsonSerializer.class)
    public Integer getGender(){
        return gender;
    }

}
